package com.jvtd.baseProject.di.module;

import android.content.Context;
import android.support.v7.app.AppCompatActivity;

import com.jvtd.baseProject.di.ActivityContext;
import com.jvtd.baseProject.di.ActivityScope;

import dagger.Module;
import dagger.Provides;
import io.reactivex.disposables.CompositeDisposable;
/**
 * Created by Administrator on 2017/10/16.
 * Activity，对应 ActivityScope
 */

@Module
public class ActivityModule
{
  private final AppCompatActivity mActivity;

  public ActivityModule(AppCompatActivity activity)
  {
    mActivity = activity;
  }

  @Provides
  @ActivityContext
  Context provideContext()
  {
    return mActivity;
  }

  @Provides
  @ActivityScope
  AppCompatActivity provideActivity()
  {
    return mActivity;
  }

  @Provides
  @ActivityScope
  CompositeDisposable provideCompositeDisposable()
  {
    return new CompositeDisposable();
  }

}
